package com.Date.DateTools;
import java.text.ParseException;
import java.util.Date;
import java.text.SimpleDateFormat;
/*工具类
* 构造方法--私有
* 成员方法--静态
* */
public class DateUtils {
    private DateUtils(){}
    public static String dateToString(Date date,String format){
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        String s = sdf.format(date);
        return s;
    }
    public static Date stringToDate(String s,String format) throws ParseException {
        SimpleDateFormat sdf1 = new SimpleDateFormat(format);
        Date d = sdf1.parse(s);
        return d;
    }
}
